<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>边框流动</title>
    <style>
      body {
        background-color: #000;
      }
      .box {
        position: relative;
        width: 180px;
        height: 250px;
        background: rgba(0, 0, 0, 0.8);
        border-radius: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
      }
      h2 {
        color: white;
        font-size: 4em;
        text-shadow: 2px 2px pink;
        z-index: 1;
      }
      .box::before {
        content: ' ';
        position: absolute;
        width: 120px;
        height: 120%;
        background: linear-gradient(#00ccff, #d500f9);
      }
      .box::after {
        content: ' ';
        position: absolute;
        background: #2844cf;
        inset: 5px; /* inset:5px === top 5px left 5px right 5px bottom 5px */
        border-radius: 20px;
      }
      .box::before {
        animation: rotate 4s linear infinite;
      }
      @keyframes rotate {
        from {
          transform: rotate(0deg);
        }
        to {
          transform: rotate(360deg);
        }
      }
    </style>
  </head>
  <body>
    <div class="box">
      <h2>CSS</h2>
    </div>
  </body>
</html>
